<!DOCTYPE html>
<!-- saved from url=(0041)http://localhost/questionDetail.html?id=8 -->
<html data-dpr="3" style="font-size: 37.1px;">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


    <title>骡窝窝问答</title>
    <meta name="viewport"
          content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui,viewport-fit=cover">
    <meta property="og:url" content="https://m.mafengwo.cn/wenda/detail-5246076.html">
    <script type="text/javascript" async="" charset="utf-8" src="./question_files/core.php"></script>
    <script type="text/javascript" async="" charset="utf-8" src="./question_files/c.php"></script>
    <script type="text/javascript" async="" charset="utf-8" src="./question_files/core(1).php"></script>
    <script type="text/javascript" async="" charset="utf-8" src="./question_files/core(2).php"></script>
    <script type="text/javascript" async="" charset="utf-8" src="./question_files/c(1).php"></script>
    <script type="text/javascript">

    </script>
    <link href="./question_files/mobile+css+1526627473.css" rel="stylesheet" type="text/css">


    <link href="./question_files/new_ask2016.css" rel="stylesheet" type="text/css">

    <script async="" src="./question_files/mobile+js+wenda.下载" crossorigin="anonymous"></script>
    <link href="./question_files/mobile+css+1535539097.css" rel="stylesheet" type="text/css">

    <link href="./question_files/mobile+css+1537351708question.css" rel="stylesheet" type="text/css">

    <script language="javascript"
            src="./question_files/mobile+js+jquery-2.1.4_mobile+js+jquery.mobile-events_mobile+mfwappsdk^Yl1U^1.下载"
            type="text/javascript" crossorigin="anonymous"></script>

    <script async="" src="./question_files/mobile+js+Pop_mobile+1538043348.js.下载" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/news.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>

    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <style type="text/css">
        .head2home {
            background: #4D4C4B;
            color: white;
            content: '\f053';
            font-size: 18px;
            line-height: 50px;
        }
    </style>
    <script>
        $(function () {
            var param = getParams();
            if (param.questionId) {
                $.get("/questions/" + param.questionId, function (data) {
                    $('.q-detail').renderValues(data, {
                        'getAddress': function (item, value) {
                            var add = $(item).data('href');
                            $(item).attr('href', add + value);
                        }
                    });
                });

                //为添加回答的按钮添加href属性
                var href = $("#add_answer").data('href');
                $("#add_answer").attr("href", href + param.questionId);
                //评论相关
                //获取当前页的input框
                var currentInput = $('#currentPage');
                //存放数据的新数组
                var answerarr = [];
                //总页数
                var pages = 1;

                function query() {
                    //获取当前页的值
                    var currentPage = currentInput.val()

                    //获取回答并渲染
                    $.get('/answers/' + param.questionId + '/list', {
                            currentPage: currentPage,
                            pageSize: 3
                        }, function (data) {
                            //合并两个数组到第一个数组
                            $.merge(answerarr, data.list);
                            var json = {list: answerarr};
                            $('#_j_answer_list').renderValues(json, {
                                'getAddress': function (item, value) {
                                    var add = $(item).data('href');
                                    $(item).attr('href', add + value);
                                }
                            });

                            //获取总页数
                            pages = data.pages;
                            $.each(data.list, function (index, value) {
                                $.get("/answers/comment/" + value.id, function (data) {
                                    $('#answerComment').renderValues({list: data.result},
                                        {
                                            'getAddress': function (item, value) {
                                                var add = $(item).data('href');
                                                $(item).attr('href', add + value);
                                            }
                                        }
                                    )
                                })
                            })
                        }
                    );
                    //当前input框的值加1
                    currentInput.val(parseInt(currentPage) + 1);
                }

                //默认查询第一页的数据
                query();
                //获取更多评论函数
                $('._j_add_more_button').click(function () {
                    if ($(document).scrollTop() + $(window).height() >= $(document).height()) {
                        //获取下一页
                        var currentPage = currentInput.val();
                        if (currentPage <= pages) {
                            query();
                        } else {
                            $(document).dialog({
                                type: 'notice',
                                infoText: '没有了哦,看别的吧',
                                autoClose: 1500,
                                position: 'center'
                            });
                        }
                    }


                });
            }
        })

    </script>
</head>
<body style="font-size: 36px;">
<div id="pos38"></div>
<header class="head2home">
    <div class="row ">
        <div class="col " style="margin: 0px 7px;">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>社区问答</span>
        </div>
        <div class="col"></div>
    </div>
</header>
<hr/>
<section class="container no-padding">
    <div class="q-detail">
        <h3 class="title" render-html="title"></h3>
        <p class="desc" render-html="content"></p>
        <div class="stat">
            <span class="nums">
                <b render-html="answerCount"></b>回答
            </span>

        </div>
        <div class="meta">
            <span class="user">
                <a data-href="userProfiles.html?id=" render-key="user.id" render-fun="getAddress">
                        <img render-src="user.headImgUrl">
                    </a>
                <span render-html="user.nickName"></span> 于
                <span class="time" render-html="createTime"></span>
            </span>
        </div>
    </div>
    <div id="_j_answer_list">
        <div render-loop="list">
            <div class="a-detail">
                <span class="da">
                    <a data-href="userProfiles.html?id=" render-key="list.user.id" render-fun="getAddress">
                        <img render-src="list.user.headImgUrl">
                    </a>
                </span>
                <div class="hd">
                    <a class="name" render-html="list.user.nickName"></a>
                    <span class="time" render-html="list.createTime"></span>
                </div>
                <div class="bd">
                    <div class="expandable" style="max-height: 9.33333rem;">
                        <p render-html="list.content"></p>
                    </div>
                </div>
                <div class="ft">
                    <a class="d-flex icon" data-href="/mine/addAnswerComment.html?answerId=" render-key="list.id"
                       render-fun="getAddress">
                        <i class="fa  fa-commenting-o commentdouble" style="margin-right: 10px"> 评论 <b render-html="list.commentCount"></b></i>
                    </a>
                </div>

            </div>
        </div>
    </div>
    <div id="answerComment">
        <div render-loop="list">
            <div class="container row comment">
                <div class="col-2 comment-head">
                    <a data-href='userProfiles.html?id=' render-key="list.user.id" render-fun="getAddress">
                        <img class="rounded-circle"
                             render-src="list.user.headImgUrl">
                    </a>
                </div>
                <div class="col comment-right">
                    <a data-href=userProfiles.html?id=' render-key="list.user.id" render-fun="getAddress">
                        <p class="authorName"><span render-html="list.user.nickName"></span>
                            <span class="comment-date" render-html="list.createTime"></span>
                        </p> </a>

                    <div class="comment-content">
                        <p render-html="list.content"></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="margin-bottom: 10px;" class=" a-list">
        <a class="more-list _j_add_more_button" style="font-size: small">更多回答</a>
    </div>
    <div style="margin-bottom: 10px;" class=" a-list">
        <a class="" style="font-size: small">&nbsp;</a>
    </div>
</section>

<div id="pos44"></div>
<div id="pos354"></div>


<section class="askfoot">
    <a class="btn-que" style="display: block;
    background: #ffa800;
    margin: 10px 4%;
    height: 30px;
    border-radius: 4px;
    color: #FFF;
    font-size: 15px;
    text-align: center;
    line-height: 30px;" id="add_answer" data-href="/mine/addAnswer.html?questionId="
    ><i class="icon-addanswer"></i>添加答案</a>
</section>
<!--当前页的隐藏输入框-->
<input name="currentPage" id="currentPage" type="hidden" value="1">

</body>
</html>